//
//  LikeAndNotLikeView.m
//  OnionHome
//
//  Created by fengjie on 2019/9/22.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "LikeAndNotLikeView.h"
#import "NotLikeToastController.h"

@implementation LikeAndNotLikeView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}
-(void)createUI{
    [self addSubview:self.leftButton];
    [self addSubview:self.rightButton];

    [self.leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(0);
        make.height.mas_equalTo(20);
    }];
    [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.bottom.mas_equalTo(0);
        make.height.mas_equalTo(20);

    }];

}

-(UIButton*)leftButton{
    if(!_leftButton){
        _leftButton=[UIButton buttonWithType:UIButtonTypeCustom];
        [_leftButton setBackgroundImage:IMAGE_NAMED(@"Like") forState:UIControlStateNormal];
        
    }
    return _leftButton;
}
-(UIButton*)rightButton{
    if(!_rightButton){
        _rightButton=[UIButton buttonWithType:UIButtonTypeCustom];
        [_rightButton setBackgroundImage:IMAGE_NAMED(@"NotLike") forState:UIControlStateNormal];
        kWeakSelf(weakSelf);
        [_rightButton addActionHandler:^{
            PresentationObject * object = [PresentationObject sharedPresentationObject];
            object.subViewFrame = CGRectMake(0, KScreenHeight-350, KScreenWidth, 350);
            [object showPresentingViewController:[weakSelf getCurrentViewController] PresentedViewController:[[BasseNavigationController alloc]initWithRootViewController:[NotLikeToastController new]]];
        }];
    }
    return _rightButton;
}

@end
